package com.example.springbootjspshiro.mapperTest;

import com.example.springbootjspshiro.mapper.UserMapper;
import com.example.springbootjspshiro.pojo.Perms;
import com.example.springbootjspshiro.pojo.Role;
import com.example.springbootjspshiro.pojo.User;
import com.example.springbootjspshiro.service.UserService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

@SpringBootTest
public class test01 {
    @Autowired
    UserService userService;
    @Autowired
    UserMapper userMapper;
    @Test
    public void FindRolesByNameText(){
        List<Role> yangkai = userService.findRolesByUserName("yangkai");
        for (Role role : yangkai) {
            System.out.println(role);
        }
    }
    @Test
    public void FindUserRoleByNameText(){
        User yangkai = userMapper.findUseRolesByUsername("yangkai");
        System.out.println(yangkai);
    }
    @Test
    public void FindPermsByRoleIdNameText(){
        final List<Perms> permsByRoleId = userMapper.findPermsByRoleId(2);
        for (Perms perms : permsByRoleId) {
            System.out.println(perms.getName());
        }
    }
}
